package com.cjk.foundation.dao;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.cjk.foundation.entity.DeviceChangeLogEntity;
import com.cjk.foundation.entity.WatchLogEntity;

@Repository
public interface WatchLogDao {
	
	public List<WatchLogEntity> selectCurrentChannelPlayNum(@Param("userId") Integer userId, @Param("groupId") Integer groupId, @Param("startTime") Date startTime);
	
	public void insert(WatchLogEntity watchLogEntity);
	
	public void insertDeviceChangeLog(DeviceChangeLogEntity deviceChangeLogEntity);
	
	public List<WatchLogEntity> selectListByCondition(@Param("sn") String sn, @Param("userId") Integer userId, @Param("groupId") Integer groupId, @Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
	
	public Integer selectCountByCondition(@Param("sn") String sn, @Param("userId") Integer userId, @Param("groupId") Integer groupId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
	
	@Delete("delete from watch_log where create_time < #{createTime}")
	public void deleteByCreateTime(@Param("createTime") Date createTime);
	
}
